import api from "@/api";
import { PORT } from "../config/servicePort";

//****用户 */
/* 获取用户列表*/
export const getUserList = (data?: any) => api.post(`/api/system/user/page`, data);
/* 创建用户*/
export const createUser = (data?: any) => api.post(`/api/system/user/save`, data);
/* 更新用户*/
export const updateUser = (data?: any) => api.post(`/api/system/user/update`, data);
/* 删除用户*/
export const deleteUser = (data?: any) => api.post(`/api/system/user/delete/${data.id}`);
/* 重置密码*/
export const resetPassword = (data?: any) => api.post(`/api/system/user/resetpwd`, data);



//****角色 */
/* 获取角色列表*/
export const getRoleList = (data?: any) => api.post(`/api/system/role/page`, data);
/* 获取角色列表*/
export const getAllRole = (data?: any) => api.post(`/api/system/role/list`, data);
/* 创建角色*/
export const createRole = (data?: any) => api.post(`/api/system/role/save`, data);
/* 更新角色*/
export const updateRole = (data?: any) => api.post(`/api/system/role/update`, data);
/* 删除角色*/
export const deleteRole = (data?: any) => api.post(`/api/system/role/delete/${data.id}`);
/* 获取用户权限列表*/
export const getAuthByRole = (data?: any) => api.post(`/api/system/role/${data.id}/getMenus`);
/* 分配角色权限*/
export const setAuthByRole = (data?: any) => api.post(`/api/system/role/${data.id}/assignMenus`, data.menuIds);




//****组织 */
/* 获取组织列表*/
export const getOrganizationList = (data?: any) => api.post(`/api/system/org/getPage`, data);
/* 获取组织树结构全量数据*/
export const getOrgTreeList = (data?: any) => api.post(`/api/system/org/tree`, data);
/* 创建组织*/
export const createOrg = (data?: any) => api.post(`/api/system/org/save`, data);
/* 更新组织*/
export const updateOrg = (data?: any) => api.post(`/api/system/org/update`, data);
/* 删除组织*/
export const deleteOrg = (data?: any) => api.post(`/api/system/org/delete/${data.id}`);




//****岗位 */
/* 获取岗位列表*/
export const getPostList = (data?: any) => api.post(`/api/system/post/page`, data);
/* 创建岗位*/
export const createPost = (data?: any) => api.post(`/api/system/post/save`, data);
/* 更新岗位*/
export const updatePost = (data?: any) => api.post(`/api/system/post/update`, data);
/* 删除岗位*/
export const deletePost = (data?: any) => api.post(`/api/system/post/delete/${data.id}`);




//****菜单 */
/* 获取菜单列表*/
export const getMenuList = (data?: any) => api.post(`/api/system/menu/getPage`, data);
/* 获取菜单全量树结构*/
export const getMenuTreeList = (data?: any) => api.post(`/api/system/menu/tree`, data);
/* 创建菜单*/
export const createMenu = (data?: any) => api.post(`/api/system/menu/save`, data);
/* 更新菜单*/
export const updateMenu = (data?: any) => api.post(`/api/system/menu/update`, data);
/* 删除菜单*/
export const deleteMenu = (data?: any) => api.post(`/api/system/menu/delete/${data.id}`);




//****字典 */
/* 获取字典列表*/
export const getDictList = (data?: any) => api.post(`/api/system/dict/category/page`, data);
/* 创建字典*/
export const createDict = (data?: any) => api.post(`/api/system/dict/save`, data);
/* 更新字典*/
export const updateDict = (data?: any) => api.post(`/api/system/dict/update`, data);
/* 删除字典*/
export const deleteDict = (data?: any) => api.post(`/api/system/dict/delete/${data.id}`);
